var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(e, t) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(e, t) {
        e.__proto__ = t;
    } || function(e, t) {
        for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]);
    })(e, t);
}, function(e, t) {
    function n() {
        this.constructor = e;
    }
    o(e, t), e.prototype = null === t ? Object.create(t) : (n.prototype = t.prototype, 
    new n());
}), a = this && this.__decorate || function(e, t, n, o) {
    var a, i = arguments.length, r = i < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(e, t, n, o); else for (var s = e.length - 1; 0 <= s; s--) (a = e[s]) && (r = (i < 3 ? a(r) : 3 < i ? a(t, n, r) : a(t, n)) || r);
    return 3 < i && r && Object.defineProperty(t, n, r), r;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("Global"), s = e("GameConfig"), c = e("LoadManager"), l = cc._decorator, d = l.ccclass, u = l.property, p = function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.month = null, e.day = null, e.interval = null, e.skeleton = null, e.sprite = null, 
        e;
    }
    return i(e, t), e.prototype.start = function() {
        this.initDate(), this.initSkin();
    }, e.prototype.initDate = function() {
        var e = new Date(Date.now() + r.G.seasonNextTime), t = e.getMonth() + 1, n = e.getDate(), e = Math.ceil(r.G.seasonNextTime / r.G.ONE_DAY_TIME);
        console.log("month", t, "day", n), 9 < t && this.appendSprite("image/num/" + Math.floor(t / 10) + "@2x", this.month), 
        this.appendSprite("image/num/" + t % 10 + "@2x", this.month), 9 < n && this.appendSprite("image/num/" + Math.floor(n / 10) + "@2x", this.day), 
        this.appendSprite("image/num/" + n % 10 + "@2x", this.day), 9 < e && this.appendSprite("image/num/" + Math.floor(e / 10) + "d@2x", this.interval), 
        this.appendSprite("image/num/" + e % 10 + "d@2x", this.interval);
    }, e.prototype.appendSprite = function(e, t) {
        var n = new cc.Node().addComponent(cc.Sprite);
        n.node.parent = t, c.default.getInstance().loadSpriteFrame({
            url: e,
            sprite: n
        });
    }, e.prototype.initSkin = function(e, t) {
        var n = this;
        isNaN(e) && (e = r.G.seasonPersonIdx == s.GC.maxPersonIdx ? r.G.seasonPersonIdx : s.GC.seasonPersonList[r.G.season % s.GC.seasonPersonList.length]), 
        isNaN(t) && (t = r.G.seasonGunIdx == s.GC.maxGunIdx ? r.G.seasonGunIdx : s.GC.seasonGunList[r.G.season % s.GC.seasonGunList.length]), 
        cc.log("seasonLoad initSkin", e, t), c.default.getInstance().loadRes({
            url: "skin/" + e + "/skeleton",
            type: sp.SkeletonData
        }).then(function(e) {
            n.skeleton && e instanceof sp.SkeletonData && (n.skeleton.skeletonData = e, n.skeleton.setAnimation(0, "animation3", !0));
        }), c.default.getInstance().loadSpriteFrame({
            url: "image/arm2/" + t,
            sprite: this.sprite
        });
    }, a([ u(cc.Node) ], e.prototype, "month", void 0), a([ u(cc.Node) ], e.prototype, "day", void 0), 
    a([ u(cc.Node) ], e.prototype, "interval", void 0), a([ u(sp.Skeleton) ], e.prototype, "skeleton", void 0), 
    a([ u(cc.Sprite) ], e.prototype, "sprite", void 0), a([ d ], e);
}(cc.Component);

n.default = p;